﻿using System;
using System.Collections.Generic;
using System.Text;
using ArlesInterfaces.Editor;
using Arles.src.utils.LogTypes;

namespace Arles.src.utils
{
    public class LogFactory
    {
        private static ILog handle;

        /// <summary>
        /// Constructor privado (Singleton)
        /// </summary>
        private LogFactory() { }

        #region Methods
        /// <summary>
        /// Obtiene la única instancia de la factoría
        /// </summary>
        /// <returns></returns>
        public static ILog Instance
        {
            get
            {
                if (handle == null)
                    handle = CreateLog(ConfigFile.Instance.Attributes.LogType);

                return handle;
            }
        }

        /// <summary>
        /// Crea un tipo de log u otro
        /// </summary>
        /// <param name="FactoryType"></param>
        /// <returns></returns>
        static ILog CreateLog(string FactoryType)
        {
            ILog log = null;

            switch (FactoryType)
            {
                case "File":
                    log = new FileLog();
                    break;
            }

            return log;
        } 

        #endregion
    }
}
